package com.hdy.orderforthree.widget;

import android.content.Context;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;

import com.hdy.orderforthree.R;

/**
 * 带点击框外消失功能
 */
public class ResetLoginDialogPop extends LoginBasePop {

    public ResetLoginDialogPop(Context context) {
        super(R.layout.reset_login_layout, context);

        if (((ViewGroup)mLayout).getChildCount() > 0) {
            View view = ((ViewGroup) mLayout).getChildAt(0);
            view.setOnTouchListener(new View.OnTouchListener() {
                @Override
                public boolean onTouch(View v, MotionEvent event) {
                    return true;
                }
            });
        }
        mLayout.setOnTouchListener(new View.OnTouchListener() {
            @Override
            public boolean onTouch(View v, MotionEvent event) {
                if (event.getAction() == MotionEvent.ACTION_UP) {
                    removeView();
                }
                return true;
            }
        });
    }
}
